//
//  OcrPCaptureManager.h
//  ocr_plugin
//
//  Created by FXY on 2022/1/20.
//

#import <Foundation/Foundation.h>

#import "OcrPModel.h"

NS_ASSUME_NONNULL_BEGIN
@protocol OcrPCaptureManagerDelegate<NSObject>

@optional

- (void)successWithInfo:(OcrPModel*)info image:(UIImage *)image ;

-(void)failureWithTitle:(NSString *)title message:(NSString *)message;

@end

@interface OcrPCaptureManager : NSObject

@property (weak, nonatomic) id<OcrPCaptureManagerDelegate>             delegate;

/// 证件类型 0-身份证正面，1-身份证反面
@property (nonatomic,assign) NSInteger type;
/// 是否开启识别
@property (nonatomic,assign) BOOL scanEnable;
/// 拍照是否需要旋转
@property (nonatomic,assign) BOOL takePhotoRotated;

/// 自动停止扫描
@property (nonatomic,assign) BOOL autoStopScan;

// 人脸检测框区域
@property (nonatomic,assign) CGRect detectionFrame;

/// 是否按取景框裁剪
@property (nonatomic,assign) BOOL cropEnable;

/// 取景框满屏，或接近满屏
@property (nonatomic,assign) BOOL fullArea;


- (instancetype)initWithCaptureSessionQueue:(dispatch_queue_t)captureSessionQueue;

#pragma mark - 初始化
- (void)congfigContentView:(UIView *)contentView;

- (void)configAreaFrame:(CGRect)areaFrame faceFrame:(CGRect)faceFrame;

#pragma mark - 运行session
// session开始，即输入设备和输出设备开始数据传递
- (void)runSession;

#pragma mark - 停止session
// session停止，即输入设备和输出设备结束数据传递
-(void)stopSession;

#pragma mark - 点击相册
- (void)takePhotoLibrary;

#pragma mark - 点击拍照
- (void)takePhotoCamera;

#pragma mark - 切换摄像头
- (void)switchCamera;

@end

NS_ASSUME_NONNULL_END
